package cm.auth;

/**
 * @Project: iov-bigdata-business-service
 * @Package: com.voyah.auth
 * @Author: tangxiaolin
 * @CreateTime: 2024-10-22 09:37
 * @Description: TODO
 */

public class UserContext {

    private static final ThreadLocal<UserInfo> CONTEXT = new ThreadLocal<>();

    public static UserInfo getCurrentUserInfo() {
        return CONTEXT.get();
    }

    protected static void setCurrentUserInfo(UserInfo userInfo) {
        CONTEXT.set(userInfo);
    }

    protected static void releaseCurrentUserInfo() {
        CONTEXT.remove();
    }

    public static String getCurrentUserName() {
        return CONTEXT.get().getUserName();
    }

    public static String getCurrentEmployeeNumber() {
        return CONTEXT.get().getEmployeeNumber();
    }

    public static String getCurrentPhoneNumber() {
        return CONTEXT.get().getPhone();
    }



}
